<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class InitDB extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users',function($table){
            $table->increments('id');
            $table->string('nickname',20)->nullable();
            $table->string('password',64);
            $table->string('email',50);
            $table->string('email_token',32)->nullable();
            $table->timestamp('email_token_created_at')->nullable();
            $table->string('api_token',32)->nullable();
            $table->timestamp('api_token_created_at')->nullable();
            $table->integer('active')->unsigned();
            $table->integer('state')->unsigned();
            $table->integer('permission')->unsigned();
            $table->timestamp('heartbeat_at')->nullable();
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
        Schema::dropIfExists('users');
    }
}
